package com.xubeihong.xubeihong;

import java.util.Base64;

public class Base64ApacheCommonsExample {
    public static void main(String[] args) {
        // 编码
        String originalString = "Hello, Base64 with Apache Commons!gggggggggggggggggggggggggggggggggggggg";
        String encodedString = Base64.getEncoder().encodeToString(originalString.getBytes());
        System.out.println("编码后的字符串：" + encodedString);

        // 解码
        byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
        String decodedString = new String(decodedBytes);
        System.out.println("解码后的字符串：" + decodedString);
    }
}
